import router from '@/router';
import { useStore } from 'vuex';

const whiteList = ["MapMobile","MapPreview","Login","NotFound"];
router.beforeEach((to, from, next) => {
    const store = useStore();
    if (whiteList.indexOf(to.name) !== -1) { // 在免登录白名单，直接进入
        return next()
    }
    const isLogin = store.getters.isLogin;
    if(!isLogin){
        return next('/login')
    }else{
      next();
    }
    
  })